*&---------------------------------------------------------------------*
*& Report ZEX_LISTING_55                                               *
*&---------------------------------------------------------------------*
*& Created By: James Wood (james.wood@bowdarkconsulting.com)           *
*& Created On: 12/12/2008                                              *
*& Purpose:    This program shows the behavior of constructors in an   *
*&             inheritance relationship.                               *
*&---------------------------------------------------------------------*
REPORT zex_listing_55.

*----------------------------------------------------------------------*
*       CLASS lcl_parent DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_parent DEFINITION.
  PUBLIC SECTION.
    METHODS: constructor,
             message.
ENDCLASS.                    "lcl_parent DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_parent IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_parent IMPLEMENTATION.
  METHOD constructor.
    CALL METHOD me->message.
  ENDMETHOD. "constructor

  METHOD message.
    WRITE: / 'In parent...'.
  ENDMETHOD. "message
ENDCLASS.                    "lcl_parent IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS lcl_child  DEFINITIO
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_child DEFINITION
      INHERITING FROM lcl_parent.

  PUBLIC SECTION.
    METHODS: constructor,
             message REDEFINITION.
ENDCLASS.                    "lcl_child  DEFINITIO

*----------------------------------------------------------------------*
*       CLASS lcl_child IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_child IMPLEMENTATION.
  METHOD constructor.
    CALL METHOD super->constructor.
    CALL METHOD me->message.
  ENDMETHOD. "constructor

  METHOD message.
    WRITE: / 'In child...'.
  ENDMETHOD. "message
ENDCLASS.                    "lcl_child IMPLEMENTATION

*----------------------------------------------------------------------*
* START-OF-SELECTION Event Module                                      *
*----------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM test_constructors.

*&---------------------------------------------------------------------*
*&      Form  test_constructors
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM test_constructors.

* Local Data Declarations:
  DATA: lr_parent TYPE REF TO lcl_parent,
        lr_child  TYPE REF TO lcl_child.

* Create an instance of class lcl_parent:
  CREATE OBJECT lr_parent.
  SKIP.

* Create an instance of class lcl_child:
  CREATE OBJECT lr_child.

ENDFORM.                    "test_constructors